/* 
  2012.1.1
  Lee SoHaeng
*/

// GPIO pin define
#define GPIO_PIN_0              ((unsigned int)0x0001) 
#define GPIO_PIN_1              ((unsigned int)0x0002) 
#define GPIO_PIN_2              ((unsigned int)0x0004) 
#define GPIO_PIN_3              ((unsigned int)0x0008) 
#define GPIO_PIN_4              ((unsigned int)0x0010) 
#define GPIO_PIN_5              ((unsigned int)0x0020) 
#define GPIO_PIN_6              ((unsigned int)0x0040) 
#define GPIO_PIN_7              ((unsigned int)0x0080) 
#define GPIO_PIN_8              ((unsigned int)0x0100) 
#define GPIO_PIN_9              ((unsigned int)0x0200) 
#define GPIO_PIN_10             ((unsigned int)0x0400)
#define GPIO_PIN_11             ((unsigned int)0x0800) 
#define GPIO_PIN_12             ((unsigned int)0x1000) 
#define GPIO_PIN_13             ((unsigned int)0x2000) 
#define GPIO_PIN_14             ((unsigned int)0x4000) 
#define GPIO_PIN_15             ((unsigned int)0x8000) 
#define GPIO_PIN_ALL            ((unsigned int)0xFFFF) 


// LED define
#define GPIO_LED1_PIN           GPIO_PIN_5   /* YELLOW */
#define GPIO_LED2_PIN           GPIO_PIN_9   /* RED */
#define GPIO_LED3_PIN           GPIO_PIN_8   /* GREEN/BLUE */

// GPIOB define
#define GPIOB_BSRR              (*(volatile unsigned *)0x40010C10)
#define GPIOB_BRR               (*(volatile unsigned *)0x40010C14)
#define GPIOB_CRL               (*(volatile unsigned *)0x40010C00)
#define GPIOB_CRH               (*(volatile unsigned *)0x40010C04)

// RCC define
#define RCC_APB2ENR             (*(volatile unsigned *)0x40021018) /*reset & clock control */
#define RCC_APB2PERIPH_AFIO     ((unsigned long)0x00000001)

#define RCC_APB2PERIPH_GPIOA    ((unsigned long)0x00000004)
#define RCC_APB2PERIPH_GPIOB    ((unsigned long)0x00000008)
#define RCC_APB2PERIPH_GPIOC    ((unsigned long)0x00000010)
#define RCC_APB2PERIPH_GPIOD    ((unsigned long)0x00000020)
#define RCC_APB2PERIPH_GPIOE    ((unsigned long)0x00000040)
#define RCC_APB2PERIPH_GPIOF    ((unsigned long)0x00000080)
#define RCC_APB2PERIPH_GPIOG    ((unsigned long)0x00000100)
#define RCC_APB2PERIPH_ADC1     ((unsigned long)0x00000200)
#define RCC_APB2PERIPH_ADC2     ((unsigned long)0x00000400)
#define RCC_APB2PERIPH_TIM1     ((unsigned long)0x00000800)
#define RCC_APB2PERIPH_SPI1     ((unsigned long)0x00001000)
#define RCC_APB2PERIPH_TIM8     ((unsigned long)0x00002000)
#define RCC_APB2PERIPH_USART1   ((unsigned long)0x00004000)
#define RCC_APB2PERIPH_ADC3     ((unsigned long)0x00008000)

